<script setup lang="ts">
import type { PropType } from 'vue';
import { statusData } from './const'

defineOptions({ name: 'Query' });
interface ModelValueType {
  nameCn: string;
  status: null;
}

defineProps({
  modelValue: {
    type: Object as PropType<ModelValueType>,
    required: true,
  },
  certListData: {
    type: Array,
    default: []
  }
});

const emit = defineEmits(['update:modelValue', 'queryData', 'resetQuery']);


const onQueryData = () => {
  emit('queryData');
};
const resetQuery = () => {
  emit('resetQuery',)
}
</script>
<template>
  <section class="w-full flex justify-between bg-[#fff]">
    <el-form :inline="true"
      class="w-full border-b border-color:#DCDFE6 after:content-[''] mb-[15px] after:clear-both after:block">
      <el-form-item :label="$t('common.nameTxt')">
        <el-input v-model="modelValue.nameCn" clearable style="width: 100%;" maxlength="50"
          :placeholder="$t('common.inputPhTxt', [$t('common.nameTxt')])" />
      </el-form-item>
      <el-form-item :label="$t('common.statusTxt')">
        <el-select style="width: 13%" class="flex-auto" v-model="modelValue.status" clearable
          :placeholder="$t('common.selectPhTxt', [$t('common.statusTxt')])">
          <el-option v-for="item in statusData as any" :key="item.name" :label="item.label" :value="item.name" />
        </el-select>
      </el-form-item>
      <el-form-item label="" class="float-right">
        <div class="w-full flex justify-end">
          <el-button class="mb-[10px]" @click="resetQuery">{{ $t('common.resetTxt') }}</el-button>
          <el-button class="mb-[10px]" type="primary" @click="onQueryData">{{ $t('common.searchTxt') }}</el-button>
        </div>
      </el-form-item>
    </el-form>
  </section>
</template>
<style lang="scss" scoped>
:deep(.el-form--inline .el-form-item) {
  margin-right: 24px;
  width: calc((100% - 72px)/4);

  &:nth-of-type(4n),
  &:last-of-type {
    margin-right: 0px;
  }
}

:deep(.el-form-item__label) {
  padding-right: 12px;
}

:deep(.el-date-editor .el-range__icon) {
  display: none;
}
</style>
